package cn.msqweb.service.impl;


import cn.msqweb.entity.Notice;
import cn.msqweb.mapper.NoticeMapper;
import cn.msqweb.service.NoticeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> implements NoticeService {

    @Autowired
    private NoticeMapper noticeMapper;


    @Override
    public boolean save(Notice notice) {
        notice.setShopId(1L);
        notice.setCreateTime(new Date());
        notice.setUpdateTime(new Date());
        return noticeMapper.insert(notice)>0;
    }

    @Override
    public boolean updateById(Notice notice) {
        notice.setUpdateTime(new Date());
        return noticeMapper.updateById(notice)>0;
    }
}
